Magnetic Sorting